<template>
	<view>
		<view class="top">
			<image @click="toPage('partner')" src="../static/e1.png" mode=""></image>
		</view>
		<view class="up">
			<u-row>
				<u-col :span="3" v-for="(item,index) in up" :key="index">
					<view @click="toPage(item.url)" class="list">
						<image :src="'../static/up'+index+'.png'"></image>
						<view class="name">
							{{item.name}}
						</view>
					</view>
				</u-col>
			</u-row>
		</view>
		<view class="down">
			<view class="list" @click="toPage(item.url)" v-if="item.show" v-for="(item,index) in down" :key="index">
				<image :src="'../static/down'+index+'.png'" class="icon"></image>
				<view class="name">
					{{item.name}}
				</view>
				<view class="text">
					{{item.text}}
				</view>
				<image src="../static/go.png" class="go"></image>
			</view>
		</view>
		<!-- 		
		<view class="list" v-if="is_anchor==1" @click="toPage('/pages/htmlA/setting/zhibo?push_address='+push_address)">
			<view class="item1">开启直播</view>
			<view class="item2"></view>
			<image class="right_go" src="../static/go.png" mode=""></image>
		</view>-->
		<view class="button" @click="show=true">退出登录</view>
		<u-modal @confirm="logout" v-model="show" :showTitle="false" :showCancelButton="true" :content="content">
		</u-modal>
	</view>
</template>

<script>
	var than;
	export default {
		data() {
			return {
				background: {
					'background': 'transparent'
				},
				picture: '',
				show: false,
				content: '是否退出登录',
				info: {},
				number: "",
				is_anchor: 0,
				push_address: "",
				up: [{
					name: "修改密码",
					url: "/pages/htmlA/setting/password"
				}, {
					name: "二级密码",
					url: "/pages/htmlA/setting/twopassword"
				}, {
					name: "收款码管理",
					url: "/pages/htmlA/setting/collection"
				}, {
					name: "银行卡信息",
					url: "/pages/htmlA/setting/bank"
				}],
				down: [{
					name: '合伙人',
					url: '/pages/htmlF/statistics/index',
					show: false
				}, {
					name: '账号信息',
					text: '',
					show: true
				}, {
					name: '关于我们',
					text: '',
					show: true
				}]
			}
		},
		onLoad(option) {
			than = this;
			// #ifdef APP-PLUS
			plus.runtime.getProperty(plus.runtime.appid, (wgtinfo) => {
				this.number = wgtinfo.version
				than.down[2].text = wgtinfo.version
			})
			// #endif
			than.post("api/live_anchor/info", null, function(data) {
				than.is_anchor = data.is_anchor
				than.push_address = data.push_address
			})

		},
		onShow() {
			than.post("api/center/userSelf", null, function(data) {
				than.info = data;
				than.down[1].text = data.telphone
				if (data.team_head == 1) {
					than.down[0].show = true
					console.log(than.down);
				}
			})
		},
		methods: {
			logout() {
				than.post("api/user/logout", null, function(data) {
					than.toast("退出成功")
					uni.clearStorageSync();
					setTimeout(function() {
						than.toLogin();
					}, 1000);
				})
			}
		}
	}
</script>

<style lang="less">
	.top {
		margin: 0 36rpx;
		padding-top: 20rpx;

		image {
			width: 100%;
			height: 274rpx;
		}
	}

	page {
		background: #FAFAFA;
	}

	.up {
		margin: 20rpx 36rpx;
		height: 207rpx;
		background: #FFFFFF;
		border-radius: 20rpx;

		.list {
			height: 100%;
			text-align: center;

			image {
				margin-top: 50rpx;
				margin-bottom: 20rpx;
				width: 51rpx;
				height: 51rpx;
			}

			.name {
				font-size: 28rpx;
				font-family: PingFang SC;
				font-weight: bold;
				color: #333333;
			}
		}

	}

	.down {
		margin: auto 36rpx;
		background: #FFFFFF;
		border-radius: 20rpx;

		.list {
			display: flex;
			align-items: center;
			height: 130rpx;

			.icon {
				margin: auto 26rpx;
				width: 51rpx;
				height: 51rpx;
			}

			.name {
				font-size: 28rpx;
				font-family: PingFang SC;
				font-weight: bold;
				color: #333333;
			}

			.text {
				margin-left: auto;
				margin-right: 25rpx;
			}

			.go {
				margin-right: 24rpx;
				width: 14rpx;
				height: 25rpx;
			}
		}
	}

	.button {
		margin: 175rpx 60rpx 0;
		height: 74rpx;
		background: #FB683D;
		border-radius: 20rpx;
		font-size: 30rpx;
		font-weight: bold;
		color: #FFFFFF;
		line-height: 74rpx;
		text-align: center;
	}
</style>
